.class public Lcom/example/m6wmr/YucartActivity$addgdClickListener;
.super Ljava/lang/Object;
.source "YucartActivity.java"

# interfaces
.implements Landroid/view/View$OnClickListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/example/m6wmr/YucartActivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "addgdClickListener"
.end annotation


# instance fields
.field private goodsid:Ljava/lang/String;

.field final synthetic this$0:Lcom/example/m6wmr/YucartActivity;


# direct methods
.method public constructor <init>(Lcom/example/m6wmr/YucartActivity;Ljava/lang/String;)V
    .locals 0
    .param p2, "gid"    # Ljava/lang/String;

    .prologue
    .line 720
    iput-object p1, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 721
    iput-object p2, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->goodsid:Ljava/lang/String;

    .line 723
    return-void
.end method


# virtual methods
.method public onClick(Landroid/view/View;)V
    .locals 13
    .param p1, "v"    # Landroid/view/View;

    .prologue
    .line 727
    new-instance v6, Lbean/GoodsBean;

    invoke-direct {v6}, Lbean/GoodsBean;-><init>()V

    .line 728
    .local v6, "mygoods":Lbean/GoodsBean;
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->goodsls:Ljava/util/List;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$0(Lcom/example/m6wmr/YucartActivity;)Ljava/util/List;

    move-result-object v8

    invoke-interface {v8}, Ljava/util/List;->size()I

    move-result v8

    const/4 v9, 0x1

    if-ge v8, v9, :cond_0

    .line 729
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->mcontext:Landroid/content/Context;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$1(Lcom/example/m6wmr/YucartActivity;)Landroid/content/Context;

    move-result-object v8

    const-string v9, "\u6dfb\u52a0\u8d2d\u7269\u8f66\u5931\u8d25"

    const-string v10, "\u5546\u54c1\u4e0d\u5b58\u5728"

    invoke-static {v8, v9, v10}, Lmyapp/Util;->alertdialog(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    .line 779
    :goto_0
    return-void

    .line 733
    :cond_0
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    iget-object v9, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->helper:Ldbclass/DBOpenHelper;
    invoke-static {v9}, Lcom/example/m6wmr/YucartActivity;->access$2(Lcom/example/m6wmr/YucartActivity;)Ldbclass/DBOpenHelper;

    move-result-object v9

    invoke-virtual {v9}, Ldbclass/DBOpenHelper;->getReadableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v9

    .line 734
    new-instance v10, Ljava/lang/StringBuilder;

    const-string v11, "select * from cart where goodsid="

    invoke-direct {v10, v11}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v11, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->goodsid:Ljava/lang/String;

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v10

    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    const/4 v11, 0x0

    .line 733
    invoke-virtual {v9, v10, v11}, Landroid/database/sqlite/SQLiteDatabase;->rawQuery(Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v9

    invoke-static {v8, v9}, Lcom/example/m6wmr/YucartActivity;->access$3(Lcom/example/m6wmr/YucartActivity;Landroid/database/Cursor;)V

    .line 735
    const/4 v4, 0x0

    .line 736
    .local v4, "goodscount":I
    const/4 v2, 0x1

    .line 737
    .local v2, "checkgd":Z
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->cursor:Landroid/database/Cursor;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$4(Lcom/example/m6wmr/YucartActivity;)Landroid/database/Cursor;

    move-result-object v8

    if-eqz v8, :cond_2

    .line 738
    :goto_1
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->cursor:Landroid/database/Cursor;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$4(Lcom/example/m6wmr/YucartActivity;)Landroid/database/Cursor;

    move-result-object v8

    invoke-interface {v8}, Landroid/database/Cursor;->moveToNext()Z

    move-result v8

    if-nez v8, :cond_1

    .line 747
    :goto_2
    const/4 v1, 0x1

    .line 748
    .local v1, "checkcart":Z
    add-int/lit8 v7, v4, 0x1

    .line 749
    .local v7, "newgoodcount":I
    const/4 v5, 0x0

    .local v5, "i":I
    :goto_3
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->goodsls:Ljava/util/List;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$0(Lcom/example/m6wmr/YucartActivity;)Ljava/util/List;

    move-result-object v8

    invoke-interface {v8}, Ljava/util/List;->size()I

    move-result v8

    if-lt v5, v8, :cond_3

    .line 761
    if-eqz v1, :cond_6

    .line 762
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->mcontext:Landroid/content/Context;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$1(Lcom/example/m6wmr/YucartActivity;)Landroid/content/Context;

    move-result-object v8

    const-string v9, "\u6dfb\u52a0\u8d2d\u7269\u8f66\u5931\u8d25"

    const-string v10, "\u5546\u54c1\u5e93\u5b58\u4e0d\u8db3"

    invoke-static {v8, v9, v10}, Lmyapp/Util;->alertdialog(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 739
    .end local v1    # "checkcart":Z
    .end local v5    # "i":I
    .end local v7    # "newgoodcount":I
    :cond_1
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->cursor:Landroid/database/Cursor;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$4(Lcom/example/m6wmr/YucartActivity;)Landroid/database/Cursor;

    move-result-object v8

    iget-object v9, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->cursor:Landroid/database/Cursor;
    invoke-static {v9}, Lcom/example/m6wmr/YucartActivity;->access$4(Lcom/example/m6wmr/YucartActivity;)Landroid/database/Cursor;

    move-result-object v9

    const-string v10, "goodscount"

    invoke-interface {v9, v10}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v9

    invoke-interface {v8, v9}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;

    move-result-object v8

    invoke-static {v8}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/Integer;->intValue()I

    move-result v4

    .line 740
    const/4 v2, 0x0

    goto :goto_1

    .line 745
    :cond_2
    const/4 v2, 0x1

    goto :goto_2

    .line 751
    .restart local v1    # "checkcart":Z
    .restart local v5    # "i":I
    .restart local v7    # "newgoodcount":I
    :cond_3
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->goodsls:Ljava/util/List;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$0(Lcom/example/m6wmr/YucartActivity;)Ljava/util/List;

    move-result-object v8

    invoke-interface {v8, v5}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lbean/GoodsBean;

    .line 752
    .local v3, "gb":Lbean/GoodsBean;
    invoke-virtual {v3}, Lbean/GoodsBean;->getId()Ljava/lang/String;

    move-result-object v8

    iget-object v9, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->goodsid:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v8

    if-eqz v8, :cond_5

    .line 753
    const/4 v1, 0x0

    .line 754
    invoke-virtual {v3}, Lbean/GoodsBean;->getcounts()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/Integer;->intValue()I

    move-result v0

    .line 755
    .local v0, "check1":I
    if-ge v0, v7, :cond_4

    .line 756
    const/4 v1, 0x1

    .line 758
    :cond_4
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->goodsls:Ljava/util/List;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$0(Lcom/example/m6wmr/YucartActivity;)Ljava/util/List;

    move-result-object v8

    invoke-interface {v8, v5}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v6

    .end local v6    # "mygoods":Lbean/GoodsBean;
    check-cast v6, Lbean/GoodsBean;

    .line 749
    .end local v0    # "check1":I
    .restart local v6    # "mygoods":Lbean/GoodsBean;
    :cond_5
    add-int/lit8 v5, v5, 0x1

    goto :goto_3

    .line 765
    .end local v3    # "gb":Lbean/GoodsBean;
    :cond_6
    if-eqz v2, :cond_7

    .line 768
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->db:Landroid/database/sqlite/SQLiteDatabase;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$5(Lcom/example/m6wmr/YucartActivity;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v8

    .line 769
    const-string v9, "insert into cart (shopid,goodsid,goodsname,goodscount,goodscost) values(?,?,?,?,?)"

    .line 770
    const/4 v10, 0x5

    new-array v10, v10, [Ljava/lang/Object;

    const/4 v11, 0x0

    iget-object v12, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->shopid:Ljava/lang/String;
    invoke-static {v12}, Lcom/example/m6wmr/YucartActivity;->access$7(Lcom/example/m6wmr/YucartActivity;)Ljava/lang/String;

    move-result-object v12

    aput-object v12, v10, v11

    const/4 v11, 0x1

    iget-object v12, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->goodsid:Ljava/lang/String;

    aput-object v12, v10, v11

    const/4 v11, 0x2

    invoke-virtual {v6}, Lbean/GoodsBean;->getname()Ljava/lang/String;

    move-result-object v12

    aput-object v12, v10, v11

    const/4 v11, 0x3

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v12

    aput-object v12, v10, v11

    const/4 v11, 0x4

    invoke-virtual {v6}, Lbean/GoodsBean;->getcost()F

    move-result v12

    invoke-static {v12}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;

    move-result-object v12

    aput-object v12, v10, v11

    .line 768
    invoke-virtual {v8, v9, v10}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;[Ljava/lang/Object;)V

    .line 778
    :goto_4
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    invoke-virtual {v8}, Lcom/example/m6wmr/YucartActivity;->freshcart()V

    goto/16 :goto_0

    .line 774
    :cond_7
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->cv:Landroid/content/ContentValues;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$6(Lcom/example/m6wmr/YucartActivity;)Landroid/content/ContentValues;

    move-result-object v8

    const-string v9, "goodscount"

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v10

    invoke-virtual {v8, v9, v10}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/Integer;)V

    .line 775
    iget-object v8, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->db:Landroid/database/sqlite/SQLiteDatabase;
    invoke-static {v8}, Lcom/example/m6wmr/YucartActivity;->access$5(Lcom/example/m6wmr/YucartActivity;)Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v8

    const-string v9, "cart"

    iget-object v10, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->this$0:Lcom/example/m6wmr/YucartActivity;

    # getter for: Lcom/example/m6wmr/YucartActivity;->cv:Landroid/content/ContentValues;
    invoke-static {v10}, Lcom/example/m6wmr/YucartActivity;->access$6(Lcom/example/m6wmr/YucartActivity;)Landroid/content/ContentValues;

    move-result-object v10

    new-instance v11, Ljava/lang/StringBuilder;

    const-string v12, "goodsid = \'"

    invoke-direct {v11, v12}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v12, p0, Lcom/example/m6wmr/YucartActivity$addgdClickListener;->goodsid:Ljava/lang/String;

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    const-string v12, "\'"

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    const/4 v12, 0x0

    invoke-virtual {v8, v9, v10, v11, v12}, Landroid/database/sqlite/SQLiteDatabase;->update(Ljava/lang/String;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I

    goto :goto_4
.end method
